<template>
  <view class="_p20 _wrapper-y">
    <view class="_flex _p20 _flex-space-x">
      <el-input v-model="fileUrl"></el-input>
      <el-button type="primary" @click="preview = true">预览</el-button>
    </view>
    <view v-if="fileUrl && preview" class="_page _wrapper-y _m-t-10">
      <iframe
        :src="`https://view.xdocin.com/view?src=${fileUrl}`"
        style="outline: none; border: none; width: 100%; height: 100%"
      ></iframe>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      fileUrl: "",
      preview: false,
    };
  },
  watch: {
    fileUrl() {
      this.preview = false;
    },
  },
};
</script>

<style></style>
